package test2;

import java.util.Scanner;

public class Test02 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一段字符串：");
        String str = sc.next();
        System.out.println(str);
        //假设存在
        boolean flag = true;
        int search = str.indexOf("search");
        if (search != -1){
            System.out.println("search在字符串中的索引位置为："+search);
        }else {
            System.out.println("search不存在");
        }
    }
}
